'use strict';

module.exports = app => {
  const mongoose = app.mongoose;
  const Schema = mongoose.Schema;

  const ReplySchema = new Schema({
    content: { type: String },
    topic_id: { type: String },
    author_id: { type: String },
    reply_id: { type: String },
    content_is_html: { type: Boolean },
    ups: [ String ],
  }, {timestamps: true});

  ReplySchema.index({ topic_id: 1 });
  ReplySchema.index({ author_id: 1, createdAt: -1 });

  return mongoose.model('Reply', ReplySchema, 'replies');
};
